/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.can.be;

import edu.upn.sigemfi.ope.be.Moneda;
import edu.upn.sigemfi.plt.be.Cuenta;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.swing.JOptionPane;

/**
 *
 * @author
 */
@Entity
@Table(name = "CAN_TRANSACCION_WEB")
@NamedQueries({@NamedQuery(name = "TransaccionWeb.findAll", query = "SELECT t FROM TransaccionWeb t"),
@NamedQuery(name = "TransaccionWeb.findByIdTransaccionWeb", query = "SELECT t FROM TransaccionWeb t WHERE t.idTransaccionWeb = :idTransaccionWeb"),
@NamedQuery(name = "TransaccionWeb.findByFechaTransaccionWeb", query = "SELECT t FROM TransaccionWeb t WHERE t.fechaTransaccionWeb = :fechaTransaccionWeb"),
@NamedQuery(name = "TransaccionWeb.findByMontoTransaccionWeb", query = "SELECT t FROM TransaccionWeb t WHERE t.montoTransaccionWeb = :montoTransaccionWeb")})
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "XTIPO", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue(value = "TRAW")

public abstract class TransaccionWeb implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_TRANSACCION_WEB", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Long idTransaccionWeb;
    @Column(name = "FECHA_TRANSACCION_WEB")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaTransaccionWeb;
    @Column(name = "MONTO_TRANSACCION_WEB", precision = 18, scale = 2)
    private BigDecimal montoTransaccionWeb;
    @JoinColumn(name = "FID_CAN_CUENTA", referencedColumnName = "ID_CUENTA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Cuenta fidPltCuenta;
    @Column(name = "XTIPO", length = 15)
    private String xtipo;
    @JoinColumn(name = "FID_OPE_MONEDA", referencedColumnName = "ID_MONEDA")
    @ManyToOne(fetch =  FetchType.LAZY)
    private Moneda fidOpeMoneda;
    //@OneToMany(mappedBy = "fidCanTransaccionWeb", fetch = FetchType.LAZY)
    //private List<TransaccionGiroWeb> transaccionGiroWebCollection;
    //@OneToMany(mappedBy = "fidCanTransaccionWeb", fetch = FetchType.LAZY)
    //private List<TransaccionInternaWeb> transaccionInternaWebCollection;
    //@OneToMany(mappedBy = "fidCanTransaccionWeb", fetch = FetchType.LAZY)
    //private List<TransaccionExternaWeb> transaccionExternaWebCollection;
    //@OneToMany(mappedBy = "fidCanTransaccionWeb", fetch = FetchType.LAZY)
    //private List<TransaccionServicioWeb> transaccionServicioWebCollection;

    public TransaccionWeb() {
    }

    public TransaccionWeb(Long idTransaccionWeb) {
        this.idTransaccionWeb = idTransaccionWeb;
    }

    public Long getIdTransaccionWeb() {
        return idTransaccionWeb;
    }

    public void setIdTransaccionWeb(Long idTransaccionWeb) {
        this.idTransaccionWeb = idTransaccionWeb;
    }

    public Date getFechaTransaccionWeb() {
        return fechaTransaccionWeb;
    }

    public void setFechaTransaccionWeb(Date fechaTransaccionWeb) {
        this.fechaTransaccionWeb = fechaTransaccionWeb;
    }

    public BigDecimal getMontoTransaccionWeb() {
        return montoTransaccionWeb;
    }

    public void setMontoTransaccionWeb(BigDecimal montoTransaccionWeb) {
        this.montoTransaccionWeb = montoTransaccionWeb;
    }

    public Moneda getFidOpeMoneda() {
        return fidOpeMoneda;
    }

    public void setFidOpeMoneda(Moneda fidOpeMoneda) {
        this.fidOpeMoneda = fidOpeMoneda;
    }

    public Cuenta getFidPltCuenta() {
        return fidPltCuenta;
    }

    public void setFidPltCuenta(Cuenta fidPltCuenta) {
        this.fidPltCuenta = fidPltCuenta;
    }

    public String getXtipo() {
        return xtipo;
    }

    public void setXtipo(String xtipo) {
        this.xtipo = xtipo;
    }


//    public List<TransaccionGiroWeb> getTransaccionGiroWebCollection() {
//        return transaccionGiroWebCollection;
//    }
//
//    public void setTransaccionGiroWebCollection(List<TransaccionGiroWeb> transaccionGiroWebCollection) {
//        this.transaccionGiroWebCollection = transaccionGiroWebCollection;
//    }
//
//    public List<TransaccionInternaWeb> getTransaccionInternaWebCollection() {
//        return transaccionInternaWebCollection;
//    }
//
//    public void setTransaccionInternaWebCollection(List<TransaccionInternaWeb> transaccionInternaWebCollection) {
//        this.transaccionInternaWebCollection = transaccionInternaWebCollection;
//    }
//
//    public List<TransaccionExternaWeb> getTransaccionExternaWebCollection() {
//        return transaccionExternaWebCollection;
//    }
//
//    public void setTransaccionExternaWebCollection(List<TransaccionExternaWeb> transaccionExternaWebCollection) {
//        this.transaccionExternaWebCollection = transaccionExternaWebCollection;
//    }
//
//    public List<TransaccionServicioWeb> getTransaccionServicioWebCollection() {
//        return transaccionServicioWebCollection;
//    }
//
//    public void setTransaccionServicioWebCollection(List<TransaccionServicioWeb> transaccionServicioWebCollection) {
//        this.transaccionServicioWebCollection = transaccionServicioWebCollection;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransaccionWeb != null ? idTransaccionWeb.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransaccionWeb)) {
            return false;
        }
        TransaccionWeb other = (TransaccionWeb) object;
        if ((this.idTransaccionWeb == null && other.idTransaccionWeb != null) || (this.idTransaccionWeb != null && !this.idTransaccionWeb.equals(other.idTransaccionWeb))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.can.be.TransaccionWeb[idTransaccionWeb=" + idTransaccionWeb + "]";
    }

}
